package com.ndp.fb.walle.util;

import com.alibaba.fastjson.JSONObject;

/**
 * Created by mikey on 2016/4/25.
 */
public class JSONUtil {
    /**
     * 从json中获取一个值,为null值,返回一个默认值
     *
     * @param param
     * @param key
     * @param defaultVal
     * @return
     */
    public static Integer getIntetger(String param, String key, Integer defaultVal) {
        Integer val = JSONObject.parseObject(param).getInteger(key);
        if (val == null) {
            return defaultVal;
        }
        return val;
    }
}
